function init(){
	array = new Array();
	document.getElementById("btn1").onclick=func1;
	document.getElementById("btn2").onclick=func2;

}


function Score(mid, kor,eng){
	this.mid = mid;
	this.kor = kor;
	this.eng = eng;
	this.tot = 0;
	this.avg = 0;
	/**/
	this.compute = function(){
		this.tot = Number(this.kor)+ Number(this.eng);
		this.avg = Number(this.tot)/2;
	}
	/*tot와 avg에 해당하는 getter생성*/
	
	this.getTot = function(){return this.tot;}
	this.getAvg = function(){return this.avg;}
}
	function func1(){
		f = document.frm;
		var m = f.mid.value;
		var k = f.kor.value;
		var e = f.eng.value;
		
		var t = new Score(m,k,e);
		
		array.push(t);
		t.compute();
		f.tot.value = t.getTot();
		f.avg.value = t.getAvg();
	}
function func2(){
	var f=document.frm;
	
	for(a=0;a<array.length;a++){
		f.result.value +="\n"+array[a].mid +"   "+ array[a].kor +"    " +array[a].eng +"     " 
							+array[a].tot+"    "+array[a].avg;
	}
}



